package com.warren.blog.handler;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author warren
 * @data: 2022/3/27 12:31 AM
 * @decription:
 */
public class MyInvocationHandler implements InvocationHandler {
    private Object object = null;

    public MyInvocationHandler(Object object) {
        this.object = object;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        //调用目标方法执行print()
        Object res = method.invoke(object, args);
        if (res != null) {
            Integer num = (Integer) res;
            res = num * 2;
        }
        return res;
    }
}
